package testJdk.commonUse.collections.collection;

import org.junit.Test;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author keyer
 * @Name : learn_jdk.commonUse.collections.collection.TestCollection
 * @Description : 描述
 * Created by cyd on 2021-03-16 17:13:14
 */
public class TestCollection {

    /**
     * Collection类的简单用法
     */
    @Test
    public void test01() {
        Integer[] arr = new Integer[]{1, 2, 3};
        List<Integer> list = Arrays.asList(arr);
        System.out.println(Arrays.toString(list.toArray()));

        System.out.println("-------------Collection类的逆序-------------");
        Collections.reverse(list);
        System.out.println(Arrays.toString(list.toArray()));

        System.out.println("----------Collection类直接生成map----------");
        Map<Object, Object> map = Collections.emptyMap();
        List<Object> list1 = Collections.emptyList();

        System.out.println("----------Collection类返回一个不可修改的map----------");
        Map<Object, Object> unmodifiableMap = Collections.unmodifiableMap(map);
        System.out.println(unmodifiableMap);
    }
}
